Cylinder1 = cc.Node.extend({

	ctor:function(parent,tag){
		this._super();
		parent.addChild(this,9,TAG_CYLINDER1_NODE);
		this.init();
	},
	init:function(tag){
		var cylinder1 = new Button(this, 10, TAG_CYLINDER1,"#cylinder.png", this.callback);


	},
	callback:function(p){
		var action = gg.flow.flow.action;
		var func = cc.callFunc(this.actionDone, this);	
		func.retain();
		var hand = new Hand();
		//hand.addrighthand(this, "#hand/hand_left", cc.p(-25,-25),0.6);
		switch(p.getTag()){
		case TAG_CYLINDER1:
			var cylinder1node = this.getParent().getChildByTag(TAG_CYLINDER1_NODE);
			var cylinder1 =cylinder1node.getChildByTag(TAG_CYLINDER1);
			var ber = cc.bezierTo(3, [cc.p(860,400),cc.p(500,350),cc.p(448,190)]);
			var move = cc.moveTo(1,cc.p(660,170));
			var rotate = cc.rotateTo(1, 100);
			var spawn = cc.spawn(ber,cc.sequence(cc.delayTime(3),rotate));
			var delay = cc.delayTime(2);
			var move2 = cc.moveTo(1,cc.p(480,150));
			var rotate2 = cc.rotateTo(1, 0);
			var spawn2 = cc.spawn(move2,rotate2);

			p.runAction(func);
             
			var seq = cc.sequence(spawn,delay,spawn2,cc.callFunc(function(){
				this.setVisible(false);
			},this),cc.callFunc(this.flowNext,this));
			this.runAction(seq);
			break;


		}
	},

	actionDone:function(p){
		var action = gg.flow.flow.action;
		var func = cc.callFunc(this.actionDone, this);
		switch(p.getTag()){
		case TAG_CYLINDER1:
            var parent=this.getParent();
            var shuiliu = new cc.Sprite("#flow_left.png");
			//shuiliu.setAnchorPoint(1, 1);
			shuiliu.setOpacity(0);
			shuiliu.setScale(0.8);
			shuiliu.setRotation(10);
			shuiliu.setPosition(533, 135);
			parent.addChild(shuiliu);
			var seq = cc.sequence(cc.delayTime(4),cc.fadeTo(0.5,255),cc.delayTime(1.0),cc.fadeTo(0.6,0),cc.callFunc(function(){
				shuiliu.removeFromParent();
			},this));
			shuiliu.runAction(seq);
			
//			var line = new cc.Sprite("#beaker_line.png");
//			line.setOpacity(255);
//			line.setPosition(this.width * 0.5, line.height * 0.5 + 5);
//			parent.addChild(line, 5, TAG_BEAKER_LINE);
			
			var beakernode = this.getParent().getChildByTag(TAG_BEAKER_NODE);
			var beaker=beakernode.getChildByTag(TAG_BEAKER);
			beaker.setCascadeOpacityEnabled(true);
			this.beaLine = new cc.Sprite("#beaker_line.png");
			this.beaLine.setOpacity(0);
			var fade=cc.fadeTo(1.5,200);
			this.beaLine.setScale(0.75);
			beaker.addChild(this.beaLine,1,TAG_BEAKER_LINE);
			this.beaLine.setPosition(beaker.width * 0.5+4, this.beaLine.height * 0.5 );

			this.beaLine.runAction(cc.sequence(cc.delayTime(3),fade,cc.moveTo(1,cc.p(beaker.width*0.5+4,beaker.height * 0.5))));

			var delay = cc.delayTime(1);
			var seq = cc.sequence(delay);
			p.runAction(seq);
			
			
			
			break;


		}
	},

	flowNext:function(){

		gg.flow.next();
		cc.log("下一步"+gg.flow.flow.tag);
	}

});